<?php

if(isset($_POST['AddPhoneForm']))
		{
			$model->attributes=$_POST['AddPhoneForm'];
			// validate user input and redirect to the previous page if valid
			if($model->validate())
			{
				$mssqlTransaction = Yii::app()->db->beginTransaction();
				try
				{
					if($model->save())
					{
						$orcTransaction = Yii::app()->orcdb->beginTransaction();
						try
						{
							//use the service and add to database
							//var_dump($subscriber_id); die;
							$model->addOrcAniNumber();

							//after get anisubscriber
							$orcTransaction->commit();
						}
						catch(CDbException $e)
						{
							$orcTransaction->rollBack();
							$model->addError('ORCException', $e->getMessage());
							throw  $e;
						}

						$mssqlTransaction->commit();

						$this->redirect($this->createUrl('customer/managerPhone', array('lang' => $this->language)));
					}
				}
				catch (CDbException $e)
				{
					$mssqlTransaction->rollback();
					$model->addError('SQLException', $e->getMessage());
				}
			}
		}